package com.yanq.liancar.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yanq.liancar.R;
import com.yanq.liancar.bean.FullServiceBean;

import java.util.List;

public class BSreviceAdmAdapter extends BaseQuickAdapter<FullServiceBean.DataBean,BaseViewHolder>{

    public BSreviceAdmAdapter(int layoutResId, @Nullable List<FullServiceBean.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, FullServiceBean.DataBean item) {

        helper .setText(R.id.item_tv_name2,item.getServiceName())
                .setText(R.id.item_tv_number,item.getSaleNum()+"")
                .setText(R.id.item_tv_price,"¥"+item.getServicePrice())
                .addOnClickListener(R.id.item_tv_see)
                .addOnClickListener(R.id.item_tv_modify)
                .addOnClickListener(R.id.item_tv_delete);

        ImageView img=helper.getView(R.id.item_imageview);
        TextView textView=helper.getView(R.id.item_tv_modify);
        if (item.getServiceType()==1){
            helper.setText(R.id.item_tv_name1,"精致洗车");
            Glide.with(mContext).load(R.mipmap.yuan_xiche).into(img);
        }else if (item.getServiceType()==2){
            helper.setText(R.id.item_tv_name1,"标准洗车");
            Glide.with(mContext).load(R.mipmap.yuan_dala).into(img);
        }else if (item.getServiceType()==3){
            helper.setText(R.id.item_tv_name1,"美容养护");
            Glide.with(mContext).load(R.mipmap.yuan_baoyang).into(img);
        }else if (item.getServiceType()==4){
            helper.setText(R.id.item_tv_name1,"到店保养");
            Glide.with(mContext).load(R.mipmap.yuan_dala).into(img);
        }else if (item.getServiceType()==5){
            helper.setText(R.id.item_tv_name1,"钣金喷漆");
            Glide.with(mContext).load(R.mipmap.yuan_baoyang).into(img);
        }else if (item.getServiceType()==6){
            helper.setText(R.id.item_tv_name1,"代办服务");
            Glide.with(mContext).load(R.mipmap.yuan_dala).into(img);
        }

        if (item.getServiceType()==90||item.getServiceType()==80){
            textView.setVisibility(View.GONE);
        }

    }
}
